package com.crawler.harbour.dto;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import com.crawler.harbour.common.DockCode;

/**
 * 嵩屿码头 拖车费用查询
 *
 * @author wbsheng
 * @create 2018-04-22 17:45
 **/
public class SYTuocheDto {
//	private String towingCo; // 拖车公司
//    private String payPeople; // 付费人
//    private String trailerNumber; // 拖车号
//    private String shipName; // 船名
//    private String voyageNumber; // 航次
    private String containerNo; // 箱号
    private String id;
    private String ladingBillNo; // 提单号
//    private String boxState; // 箱状态
    private String outDate; // 出场日期
    private String storageDays; // 堆存天数
    private String result;
    private String portNo = DockCode._SYT;
////    private String cargoDues; // 货物港务费
////    private String portSecurityFee; // 港口设施保安费
////    private String stockpilingFee; // 堆存费
////    private String overtimeFee; // 超时提箱费
////    private String tallyServiceSharge; // 理货服务费（代收）
////    private String customsInspectionFee; // 查验费
////    private String fumigationCharge; // 熏蒸费
////    private String healthTreatmentTee; // 卫生处理费
////    private String chargeForBox; // 调箱门费
////    private String interceptingFee; // 截单费
////    private String chargingFee; // 充电费
////    private String alterationFe; // 改配费
////    private String reloadingFee; // 退载费
////    private String advanceEntranceFee; // 提前进场费
////    private String lateFntryBoxFee; // 晚进场截箱费
////    private String otherFee; // 其它费用
    private String totalFee; // 费用合计
    private List<Fee> feeList=new ArrayList<Fee>();

//    public String getTowingCo() {
//        return towingCo;
//    }
//
//    public void setTowingCo(String towingCo) {
//        this.towingCo = towingCo;
//    }
//
//    public String getPayPeople() {
//        return payPeople;
//    }
//
//    public void setPayPeople(String payPeople) {
//        this.payPeople = payPeople;
//    }
//
//    public String getTrailerNumber() {
//        return trailerNumber;
//    }
//
//    public void setTrailerNumber(String trailerNumber) {
//        this.trailerNumber = trailerNumber;
//    }
//
//    public String getShipName() {
//        return shipName;
//    }
//
//    public void setShipName(String shipName) {
//        this.shipName = shipName;
//    }
//
//    public String getVoyageNumber() {
//        return voyageNumber;
//    }
//
//    public void setVoyageNumber(String voyageNumber) {
//        this.voyageNumber = voyageNumber;
//    }

	public String getContainerNo() {
		return containerNo;
	}

	public String getId() {
		return id;
	}



	public void setId(String id) {
		this.id = id;
	}



	public void setContainerNo(String containerNo) {
		this.containerNo = containerNo;
	}

	public String getLadingBillNo() {
        return ladingBillNo;
    }

    public void setLadingBillNo(String ladingBillNo) {
        this.ladingBillNo = ladingBillNo;
    }

//    public String getBoxState() {
//        return boxState;
//    }

    public String getPortNo() {
		return portNo;
	}

	public void setPortNo(String portNo) {
		this.portNo = portNo;
	}

//	public void setBoxState(String boxState) {
//        this.boxState = boxState;
//    }

    public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}



    public String getOutDate() {
		return outDate;
	}

	public void setOutDate(String outDate) {
		this.outDate = outDate;
	}

	public String getStorageDays() {
        return storageDays;
    }

    public void setStorageDays(String storageDays) {
        this.storageDays = storageDays;
    }

//    public String getCargoDues() {
//		return cargoDues;
//	}
//
//	public void setCargoDues(String cargoDues) {
//		this.cargoDues = cargoDues;
//	}
//
//	public String getPortSecurityFee() {
//		return portSecurityFee;
//	}
//
//	public void setPortSecurityFee(String portSecurityFee) {
//		this.portSecurityFee = portSecurityFee;
//	}
//
//	public String getStockpilingFee() {
//		return stockpilingFee;
//	}
//
//	public void setStockpilingFee(String stockpilingFee) {
//		this.stockpilingFee = stockpilingFee;
//	}
//
//	public String getOvertimeFee() {
//		return overtimeFee;
//	}
//
//	public void setOvertimeFee(String overtimeFee) {
//		this.overtimeFee = overtimeFee;
//	}
//
//	public String getTallyServiceSharge() {
//		return tallyServiceSharge;
//	}
//
//	public void setTallyServiceSharge(String tallyServiceSharge) {
//		this.tallyServiceSharge = tallyServiceSharge;
//	}
//
//	public String getCustomsInspectionFee() {
//		return customsInspectionFee;
//	}
//
//	public void setCustomsInspectionFee(String customsInspectionFee) {
//		this.customsInspectionFee = customsInspectionFee;
//	}
//
//	public String getFumigationCharge() {
//		return fumigationCharge;
//	}
//
//	public void setFumigationCharge(String fumigationCharge) {
//		this.fumigationCharge = fumigationCharge;
//	}
//
//	public String getHealthTreatmentTee() {
//		return healthTreatmentTee;
//	}
//
//	public void setHealthTreatmentTee(String healthTreatmentTee) {
//		this.healthTreatmentTee = healthTreatmentTee;
//	}
//
//	public String getChargeForBox() {
//		return chargeForBox;
//	}
//
//	public void setChargeForBox(String chargeForBox) {
//		this.chargeForBox = chargeForBox;
//	}
//
//	public String getInterceptingFee() {
//		return interceptingFee;
//	}
//
//	public void setInterceptingFee(String interceptingFee) {
//		this.interceptingFee = interceptingFee;
//	}
//
//	public String getChargingFee() {
//		return chargingFee;
//	}
//
//	public void setChargingFee(String chargingFee) {
//		this.chargingFee = chargingFee;
//	}
//
//	public String getAlterationFe() {
//		return alterationFe;
//	}
//
//	public void setAlterationFe(String alterationFe) {
//		this.alterationFe = alterationFe;
//	}
//
//	public String getReloadingFee() {
//		return reloadingFee;
//	}
//
//	public void setReloadingFee(String reloadingFee) {
//		this.reloadingFee = reloadingFee;
//	}
//
//	public String getAdvanceEntranceFee() {
//		return advanceEntranceFee;
//	}
//
//	public void setAdvanceEntranceFee(String advanceEntranceFee) {
//		this.advanceEntranceFee = advanceEntranceFee;
//	}
//
//	public String getLateFntryBoxFee() {
//		return lateFntryBoxFee;
//	}
//
//	public void setLateFntryBoxFee(String lateFntryBoxFee) {
//		this.lateFntryBoxFee = lateFntryBoxFee;
//	}
//
//	public String getOtherFee() {
//		return otherFee;
//	}
//
//	public void setOtherFee(String otherFee) {
//		this.otherFee = otherFee;
//	}

	public String getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(String totalFee) {
        this.totalFee = totalFee;
    }    

    public List<Fee> getFeeList() {
		return feeList;
	}

	public void setFeeList(List<Fee> feeList) {
		this.feeList = feeList;
	}
	
	DecimalFormat df = new DecimalFormat("0.###");
	public void addFee(String feeCode,String feeValue) {
		
		
		if(feeValue!=null&&feeValue.trim().length()!=0&&!feeValue.trim().equals("0")&&feeValue.trim().matches("^\\d+(\\.\\d+)?$")) {
			BigDecimal fee = new BigDecimal(feeValue.trim());
			
			for(Fee originalFee:feeList) {
				if(originalFee.getCostCode().equals(feeCode)) {
					BigDecimal newFee = new BigDecimal(df.format(originalFee.getFee())).add(fee);
					originalFee.setFee(newFee.doubleValue());
					return;
				}
			}
			
			this.feeList.add(new Fee(feeCode, Double.valueOf(feeValue.trim())));
						
		}
	}

	public SYTuocheDto(String id,String towingCo, String payPeople, String trailerNumber, String shipName, String voyageNumber, String containerNo, String ladingBillNo, String boxState, String outDate, String stockpilingDays, String cargoDues, String portSecurityFee, String stockpilingFee, String overtimeFee, String tallyServiceSharge, String customsInspectionFee, String fumigationCharge, String healthTreatmentTee, String chargeForBox, String interceptingFee, String chargingFee, String alterationFe, String reloadingFee, String advanceEntranceFee, String lateFntryBoxFee, String otherFee, String totalFee) {
//        this.towingCo = towingCo;
//        this.payPeople = payPeople;
//        this.trailerNumber = trailerNumber;
//        this.shipName = shipName;
//        this.voyageNumber = voyageNumber;
		this.id = id;
        this.containerNo = containerNo;
        this.ladingBillNo = ladingBillNo;
//        this.boxState = boxState;
        String str=null;
        if(!outDate.isEmpty()) {
        	String [] b = outDate.split("/");
            str ="20"+b[0]+"-"+b[1]+"-"+b[2]; 
            
        }
        this.outDate = str;
        this.storageDays = stockpilingDays;
        addFee(CostCode._300001, cargoDues);
        addFee(CostCode._300002, portSecurityFee);
        addFee(CostCode._300003, stockpilingFee);
        addFee(CostCode._300011, overtimeFee);
        addFee(CostCode._300004, tallyServiceSharge);
        addFee(CostCode._300005, customsInspectionFee);
        addFee(CostCode._300007, fumigationCharge);
        addFee(CostCode._300009, healthTreatmentTee);
        addFee(CostCode._300017, chargeForBox);
        addFee(CostCode._300014, interceptingFee);
        addFee(CostCode._300018, chargingFee);
        addFee(CostCode._300019, alterationFe);
        addFee(CostCode._300020, reloadingFee);
        addFee(CostCode._300010, advanceEntranceFee);
        addFee(CostCode._300012, lateFntryBoxFee);
        addFee(CostCode._300099, otherFee);
//        this.cargoDues = cargoDues;
//        this.portSecurityFee = portSecurityFee;
//        this.stockpilingFee = stockpilingFee;
//        this.overtimeFee = overtimeFee;
//        this.tallyServiceSharge = tallyServiceSharge;
//        this.customsInspectionFee = customsInspectionFee;
//        this.fumigationCharge = fumigationCharge;
//        this.healthTreatmentTee = healthTreatmentTee;
//        this.chargeForBox = chargeForBox;
//        this.interceptingFee = interceptingFee;
//        this.chargingFee = chargingFee;
//        this.alterationFe = alterationFe;
//        this.reloadingFee = reloadingFee;
//        this.advanceEntranceFee = advanceEntranceFee;
//        this.lateFntryBoxFee = lateFntryBoxFee;
//        this.otherFee = otherFee;
        this.totalFee = totalFee;
        this.result = "success";
    }

    public SYTuocheDto() {
    }
}
